// models/Role.js
const pool = require('../db');

class Role {
  static async findByPk(id) {
    const [rows] = await pool.query('SELECT * FROM Roles WHERE id = ?', [id]);
    return rows[0];
  }

  static async create(role) {
    const [result] = await pool.query('INSERT INTO Roles (name, description) VALUES (?, ?)', [role.name, role.description]);
    return result.insertId;
  }
}

module.exports = Role;